# -*- coding = utf-8 -*-
# @Time : 2022/2/16 19:22
# @File : topic2.py
# @Software : PyCharm


class Student:
    __name = ''
    __age = ''

    def setName(self, name):
        if name == '':
            print("温馨提示：品牌不能为空！")
        else:
            self.__name = name

    def getBrand(self):
        return self.__name

    def setAge(self, age):
        if age > 135 or age < 0:
            print("温馨提示：年龄非法！")
        else:
            self.__age = age

    def getAge(self):
        return self.__age

    def hello(self):
        print("大家好，我叫", self.__name, "，今年", self.__age, "岁了！")

    def chazhi(self, a):
        if a > self.__age:
            a1 = a - self.__age
            print("我比同桌大%s岁!" % a1)
        elif a < self.__age:
            a2 = self.__age - a
            print("我比同桌小%s岁!" % a2)
        elif a == self.__age:
            print("我和同桌一样大！")


stu = Student()
stu.setName('张三')
stu.setAge(20)
stu.hello()
stu.chazhi(24)
stu.chazhi(15)
stu.chazhi(20)
